
import * as React from 'react'
import { Card, Form, Button, Row, Col, Select, Icon, message, InputNumber, Radio, Checkbox, TreeSelect } from 'antd'
import { DescriptionList, Description, Zmage } from '..'
import * as globalActions from '../../redux/actions/GlobalAction'
import * as actions from '../../redux/actions/SecordSubmitAction'
import { StoreState } from '../../redux/Types'
import { connect } from 'react-redux'
import { Dispatch } from 'redux'
const FormItem = Form.Item
const Option = Select.Option
const RadioGroup = Radio.Group
const CheckboxGroup = Checkbox.Group
import { FormComponentProps } from 'antd/lib/form/Form'
import { post, SUBMIT_TMARK, CREATE_TMARK_DATA, get, SUBMIT_TMARK_DATA, SUBMIT_MANAGER_APPROVAL } from '../../service/api'
import PullGoods from './PullGoods'
export interface Props extends FormComponentProps{
  sample?: any
  type: number
  sampleImgs: any
  history?: any
  mainColors?: any []
  dicts?: any
  record?: any,
  pullData?: any []
  recordDetail?: (id: any) => void
  onSubmit: () => void
}
export interface State {
  shopVisible: boolean
  shopTypeCheck: any
  detail: any,
  PHVisible: boolean
}
let uuid = 0
class BaseInfo extends React.Component<any, State> {

  state = {
    shopVisible: false,
    shopTypeCheck: 0,
    detail: {},
    PHVisible: false
  }
  componentDidMount () {
    uuid = 0
    const { recordDetail, band: { id } } = this.props
    recordDetail(id)
  }
  componentWillReceiveProps (nextProps: any) {
    const { record } = nextProps
    const { detail } = this.state
    if(JSON.stringify(record) !== JSON.stringify(detail)) {
      this.review(record)
    }
  }
  componentWillUnmount() {
    this.setState({})
  }
  //数据回显
  review = (record: any) => {
    const { Color=[], Size= [], TMark={}, Trydisb=[], Shoptype={}, Shop=[], Shopclass=[], Shopreg=[] } = record
    const { form } = this.props
    let color: any [] = []
    let size: any [] = []
    let num: any [] = []
    let keys: any [] = []
    let trydisb: any [] = []
    let shop: any [] = []
    let shopclass: any [] = []
    let shopreg: any [] = []
    Color.map((detail: any) => {
      keys = [...keys, uuid]
      color = [...color, detail.colourid]
      num = [...num, detail.crate]
      uuid++
    })
    form.setFieldsValue({
      keys
    })
    Size.map((s: any) => {
      size = [...size, s.sizeid]
    })
    Trydisb.map((row: any) => {
      trydisb = [...trydisb, row.trytype]
    })
    Shop.map((row: any) => {
      shop = [...shop, row.shopid]
    }) 
    Shopclass.map((row: any) => {
      shopclass = [...shopclass, row.classid]
    }) 
    Shopreg.map((row: any) => {
      shopreg = [...shopreg, row.regid]
    })
    let param = {}
    let shopTypeCheck = 0
    if(JSON.stringify(TMark)!="{}" && TMark) {
      param = {
        erpsonid: TMark.erpsonid+'',
        bandid: TMark.bandid+'',
        seriesid: TMark.seriesid+'',
        bandslmate: TMark.bandslmate+'',
        sampletype: TMark.sampletype+'',
        bandxqmate: TMark.bandxqmate+'',
        seasonid: TMark.seasonid,
        layout: TMark.layout,
        disbtype: TMark.disbtype,
        offerprice: TMark.offerprice,
        managerprice: TMark.managerprice,
        costprice: TMark.costprice,
        lastprice: TMark.lastprice,
        saleprice: TMark.saleprice,
      }
      shopTypeCheck = TMark.disbtype
    }
    this.setState({
      ...this.state,
      detail: record,
      shopTypeCheck
    })
    let data: any = {
      ...param,
      color,
      size,
      num,
      shop,
      trydisb,
      shopclass,
      shopreg
    }
    if(Shoptype){
      data.shoptype = Shoptype.shoptype
    }
    setTimeout(() => {
      form.setFieldsValue(data)
    }, 0)
  }


  //动态删除
  remove = (k: number) => {
    const { form } = this.props
    const keys = form.getFieldValue('keys');
    if (keys.length === 0) {
      return
    }
    form.setFieldsValue({
      keys: keys.filter((key: number) => key !== k),
    })
  }
  //动态添加
  add = () => {
    const { form } = this.props
    const keys = form.getFieldValue('keys')
    const nextKeys = keys.concat(uuid)
    uuid++
    form.setFieldsValue({
      keys: nextKeys,
    })
  }
  handleCreateData = () => {
    const { band } = this.props
    get(CREATE_TMARK_DATA, { sampleId: band.id }).then((res: any) => {
      if (res.code == '1') {
        message.success('操作成功！')
      }else {
        message.error(res.errMsg)
      }
    })
  }
  handleSave = (e: any, isSubmit?: boolean) => {
    e.preventDefault()
    const { form, sample, record, dicts } = this.props
    form.validateFields((err: any, fieldsValue: any) => {
      if (err) return
      let Trydisb: any [] = []
      let Color: any [] = []
      let Size: any [] = []
      let Shoptype: any = {}
      let Shop: any [] = []
      let Shopclass: any [] = []
      let Shopreg: any [] = []
      let CheckStyle = record.CheckStyle
      let TMark = {
        bandid: fieldsValue.bandid,
        erpxxlid: fieldsValue.erpxxlid,
        layout: fieldsValue.layout,
        bandslmate: fieldsValue.bandslmate,
        bandxqmate: fieldsValue.bandxqmate,
        sampletype: fieldsValue.sampletype,
        disbtype: fieldsValue.disbtype,
        offerprice: fieldsValue.offerprice,
        managerprice: fieldsValue.managerprice,
        costprice: fieldsValue.costprice,
        lastprice: fieldsValue.lastprice,
        saleprice: fieldsValue.saleprice,
        erpsonid: fieldsValue.erpsonid,
        seriesid: fieldsValue.seriesid,
        seasonid: fieldsValue.seasonid
      }
      const { trydisb, color, num, size, shoptype, shop, shopclass, shopreg } = fieldsValue
      if(trydisb&&trydisb.length>0) {//试销
        dicts.trysale.map((row:any) => {
          if(trydisb.contains(row.value)){
            Trydisb = [...Trydisb,{
              trytype: row.value, 
              tryname: row.label
            }]
          }
        })
      }
      if(color&&color.length>0) {//颜色们
        color.map((row:any, index: number) => {
          let mainColor = dicts.expressColor.filter((r: any)=>r.value==row)[0]
          if(mainColor){
            Color = [...Color,{
              colourid: mainColor.value, 
              colourname: mainColor.label, 
              crate: num[index]
            }]
          }
        })
      }
      if(size&&size.length>0) {//尺码
        dicts.expressSize.map((row:any) => {
          if(size.contains(row.value)){
            Size = [...Size,{
              sizeid: row.value, 
              sizename: row.label
            }]
          }
        })
      }
      if(shoptype) {
        const shopv = dicts.shoptype.filter((row: any) => row.value==shoptype)
        Shoptype = {
          shoptype: shopv.value,
          typename: shopv.label
        }
      }
      if(shop&&shop.length>0) {
        dicts.shop.map((row:any) => {
          if(shop.contains(row.value)){
            Shop = [...Shop,{
              shopid: row.value, 
              shopname: row.label
            }]
          }
        })
      }
      if(shopclass&&shopclass.length>0) {
        dicts.shopclass.map((row:any) => {
          if(shopclass.contains(row.value)){
            Shopclass = [...Shopclass,{
              classid: row.value, 
              classname: row.label
            }]
          }
        })
      }
      if(shopreg&&shopreg.length>0) {
        dicts.shopreg.map((row:any) => {
          if(shopreg.contains(row.value)){
            Shopreg = [...Shopreg,{
              regid: row.value, 
              regname: row.label
            }]
          }
        })
      }
      const value = {
        sampleId: sample.sampleId,
        ids: {
          Trydisb,
          Color,
          Size,
          TMark,
          Shoptype,
          Shop,
          Shopclass,
          Shopreg,
          CheckStyle
        }
      }
      const { onSubmit } = this.props
      post(SUBMIT_TMARK, value).then((res: any) => {
        if (res.code == '1') {
          if(isSubmit) {
            get(SUBMIT_TMARK_DATA, { sampleId: sample.sampleId }).then((res: any) => {
              if (res.code == '1') {
                message.success('操作成功！')
                onSubmit()
              }else {
                message.error(res.errMsg)
              }
            })
          }else {
            message.success('操作成功！')
          }
        }else {
          message.error(res.errMsg)
        }
      })
    })
  }
  filterTree = (treeValue: any []): any => {
    if(treeValue.length>0){
      let v: any [] = []
      treeValue.map((row: any) => {
        let record: any = row
        if(record.children){
          record.disabled = true
          record.children = this.filterTree(record.children)
        }else  {
          record.disabled = false
        }
        v = [...v, record]
      })
      return v
    }
  }

  handleSecordSubmit = ()=> {}
  //更改铺货类型
  handleChangeShop = (e: any) => {
    const shopTypeCheck = e.target.value
    this.setState({
      ...this.state,
      shopTypeCheck
    })
  }
  handleVisible = (e: boolean) => {
    this.setState({
      ...this.state,
      PHVisible: e
    })
  }
  handleSubmitMa = (mask: number) => {
    const { sample: { sampleId }, onSubmit } = this.props
    post(SUBMIT_MANAGER_APPROVAL, {
      ids: sampleId,
      mask
    }).then((res: any) => {
      if (res.code == '1') {
        message.success('操作成功！')
        onSubmit()
      }else {
        message.error(res.errMsg)
      }
    })
  }
  render() {
    const { 
      sampleImgs, 
      sample, 
      form,
      pullData=[[],[],[]],
      type,
      dicts: { 
        trysale=[], 
        shop=[], 
        shoptype=[], 
        shopclass=[],
        shopreg=[],
        band=[],
        series=[],
        season=[],
        version=[],
        bdmatch=[],
        stype=[],
        bdneed=[],
        expressSize=[],
        distype=[],
        expressColor=[],
        category= []
      },
      record: { CheckStyle={} }
    } = this.props
    const { getFieldDecorator, getFieldValue } = form
    const { shopTypeCheck, PHVisible } = this.state
    const getImgs = () => {
      let imgs = []
      if(sampleImgs) {
        if(sampleImgs.limg1) imgs.push(sampleImgs.limg1)
        if(sampleImgs.limg2) imgs.push(sampleImgs.limg2)
        if(sampleImgs.limg3) imgs.push(sampleImgs.limg3)
        if(sampleImgs.limg4) imgs.push(sampleImgs.limg4)
        if(sampleImgs.limg5) imgs.push(sampleImgs.limg5)
      }
      return imgs
    }
    //获取不同铺货类型下的内容
    function getTypeValue(): any {
      if(shopTypeCheck == 0) {
        return ''
      }else if(shopTypeCheck == 1) {
        return <Row gutter={16} >
          <FormItem label="试销铺" style={{ marginLeft: 5 }}>
            {getFieldDecorator('trydisb', {
              rules: [{ required: true, message: '请选择试销铺' }],
            })(  
              <CheckboxGroup options={trysale}/>
            )}
          </FormItem>
        </Row>
      }else if(shopTypeCheck == 2) {
        return <Row gutter={16}>
          <FormItem label="品牌渠道铺" style={{ marginLeft: 5 }}>
            {getFieldDecorator('shoptype', {
              rules: [{ required: true, message: '请选择品牌渠道铺' }],
            })(  
              <RadioGroup>
                {shoptype.map((row: any) => <Radio key={row.value} value={row.value}>{row.label}</Radio>) }
              </RadioGroup>
            )}
          </FormItem>
        </Row>
      }else if(shopTypeCheck == 3) {
        return <Row gutter={16}>
          <FormItem label="补充铺" style={{ marginLeft: 5 }}>
            {getFieldDecorator('shop', {
              rules: [{ required: true, message: '请选择补充铺' }],
            })(  
              <Select placeholder="请选择补充铺">
                {shop.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
              </Select>
            )}
          </FormItem>
        </Row>
      }else if(shopTypeCheck == 4) {
        return <Row gutter={16}>
          <FormItem label="级别铺" style={{ marginLeft: 5 }}>
            {getFieldDecorator('shopclass', {
              rules: [{ required: true, message: '请选择级别铺' }],
            })(  
              <CheckboxGroup options={shopclass} />
            )}
          </FormItem>
        </Row>
      }else if(shopTypeCheck == 5) {
        return <Row gutter={16}>
          <FormItem label="区域铺" style={{ marginLeft: 5 }}>
            {getFieldDecorator('shopreg', {
              rules: [{ required: true, message: '请选择区域铺' }],
            })(  
              <CheckboxGroup options={shopreg} />
            )}
          </FormItem>
        </Row>
      }
    }
    getFieldDecorator('keys', { initialValue: [] })
    const keys = getFieldValue('keys') || []
    const formItems = keys.map((k: number, index: number) => {
      return (<div key={k+1} style={{ width: "65%"}}>
          <Row gutter={24}>
            <Col span={10}>
              <FormItem>
                {getFieldDecorator(`color[${k+1}]`, { rules: [{ required: true, message: '请选择' }],})(
                  <Select placeholder="请选择颜色">
                    {expressColor.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>)}
                  </Select>
                )}
              </FormItem>
            </Col>
            <Col span={10}>
              <FormItem>
                {getFieldDecorator(`num[${k+1}]`, { rules: [{ required: true, message: '请选择' }]})(
                  <InputNumber placeholder="输入总仓备量占比，如0.3" style={{ marginRight: 8, width: '100%' }}/>
                )}
              </FormItem>
            </Col>
            <Col span={4}>
              <FormItem>
                {keys.length > 0 ? (
                  <Icon
                  style={{ marginTop: 5 }} 
                    className="dynamic-delete-button"
                    type="minus-circle-o" 
                    onClick={() => this.remove(k)}
                  />
                ) : null}
              </FormItem>
            </Col>
          </Row>
        </div>
      )
    })
    const getOpBtn = (): any => {
      if(type == 1) {
        return (
          <div style={{ marginTop: 32, textAlign: 'center' }}>
            <Button type="primary" htmlType="submit">
              保存
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={this.handleCreateData}>
              生成铺货数据
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={() => this.handleVisible(true)}>
              预览铺货数据
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={(e: any) => this.handleSave(e, true)}>
              提交
            </Button>
          </div>
        )
      }else if(type == 2) {
        return (
          <div style={{ marginTop: 32, textAlign: 'center' }}>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={() => this.handleSubmitMa(1)}>
              通过
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={() => this.handleSubmitMa(1)}>
              不通过
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={() => this.handleVisible(true)}>
              预览铺货数据
            </Button>
          </div>
        )
      }else if(type == 3) {
        return (
          <div style={{ marginTop: 32, textAlign: 'center' }}>
            <Button type="primary" htmlType="submit">
              保存
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={this.handleCreateData}>
              生成铺货数据
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={() => this.handleVisible(true)}>
              预览铺货数据
            </Button>
            <Button type="primary" style={{ marginLeft: 8 }} onClick={(e: any) => this.handleSave(e, true)}>
              提交
            </Button>
          </div>
        )
      }
    }
    return(
      <div>
        <Card bordered  title="基本资料">
          <DescriptionList size="large" title="样衣图片" style={{ marginBottom: 32 }}>
            <Description term="" style={{width: "100%"}}>
              {getImgs().map((img: string, index: number) => (
                <Zmage key={index} className="yy-img" src={img} />
              ))}
            </Description>
          </DescriptionList>
          <DescriptionList size="large" title="样衣信息" style={{ marginBottom: 32 }}>
            <Description term="样衣编码">{sample.sampleId}</Description>
            <Description term="波段号">{sample.bandname}</Description>
            <Description term="大类">{sample.dlText}</Description>
            <Description term="小小类">{sample.xlText}</Description>
            <Description term="供应商货号">{sample.pcode}</Description>
            <Description term="合作方式">{sample.jyfs}</Description>
            <Description term="供应商编码">{sample.supplierid}</Description>
            <Description term="供应商名称">{sample.vendername}</Description>
            <Description term="产地">{sample.place}</Description>
            <Description term="安全类别">{sample.SECURITY}</Description>
            <Description term="执行标准">{sample.execut}</Description>
            <Description term="面料成分">{sample.fabric}</Description>
            <Description term="初始报价">{sample.cost}</Description>
          </DescriptionList>
        </Card>
        <Form layout="vertical" hideRequiredMark onSubmit={this.handleSave} style={{marginTop:-42}}>
          <Card title="基本信息" bordered={false}>
            <Row gutter={10}>
              <Col lg={6} md={12} sm={24}>
                <FormItem label="波段">
                  {getFieldDecorator('bandid', {
                    rules: [{ required: true, message: '请选择波段' }],
                  })(  
                    <Select placeholder="请选择波段">
                      {band.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
                <FormItem label="买手部建议风格">
                  <span style={{color: 'red'}}>{CheckStyle.dispstyleText}</span>
                </FormItem>
              </Col>
              <Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
                <FormItem label="陈列部建议风格">
                  <span style={{color: 'red'}}>{CheckStyle.purstyleText}</span>
                </FormItem>
              </Col>
            </Row>
            <Row gutter={10}>
              <Col lg={6} md={12} sm={24}>
                <FormItem label="确认风格">
                  {getFieldDecorator('erpsonid', {
                    rules: [
                      { required: true, message: '请选择风格' },
                    ],
                  })(
                    <TreeSelect
                      showSearch
                      treeData = {this.filterTree(category)}
                      dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                      placeholder="请选择风格"
                      allowClear
                      // onChange={this.changeStyle}
                    />
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
                <FormItem label="系列">
                  {getFieldDecorator('seriesid', {
                    // rules: [{ required: true, message: '请选择系列' }],
                  })(
                    <Select placeholder="请选择风格">
                      {series.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
                <FormItem label="季节">
                  {getFieldDecorator('seasonid', {
                    rules: [{ required: true, message: '请选择季节' }],
                  })(
                    <Select placeholder="请选择季节">
                      {season.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
            </Row>
            <Row gutter={10}>
              <Col lg={6} md={12} sm={24}>
                <FormItem label="版型">
                  {getFieldDecorator('layout', {
                    rules: [{ required: true, message: '请选择版型' }],
                  })(
                    <Select placeholder="请选择版型">
                      {version.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
                <FormItem label="波段款数匹配度">
                  {getFieldDecorator('bandslmate', {
                    rules: [{ required: true, message: '请选择波段款数匹配度' }],
                  })(
                    <Select placeholder="请选择波段款数匹配度">
                      {bdmatch.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
                <FormItem label="商品类型">
                  {getFieldDecorator('sampletype', {
                    rules: [{ required: true, message: '请选择商品类型' }],
                  })(
                    <Select placeholder="请选择商品类型">
                      {stype.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
            </Row>
            <Row gutter={16}>
              <Col lg={6} md={12} sm={24}>
                <FormItem label="波段款式需求匹配度">
                  {getFieldDecorator('bandxqmate', {
                    rules: [{ required: true, message: '请选择波段款式需求匹配度' }],
                  })(
                    <Select placeholder="请选择波段款式需求匹配度">
                      {bdneed.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
                <FormItem label="尺码">
                  {getFieldDecorator('size', {
                    rules: [{ required: true, message: '请选择尺码' }],
                  })(
                    <Select placeholder="请选择尺码" mode="multiple">
                      {expressSize.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>) }
                    </Select>
                  )}
                </FormItem>
              </Col>
            </Row>
            <Row gutter={16}  style={{ marginBottom: -62 }}>
            <Col span={28}>
              <FormItem  label="颜色">
              <div key={0} style={{ width: "65%"}}>
          <Row gutter={24}>
            <Col span={10}>
              <FormItem>
                {getFieldDecorator(`color[${0}]`, { rules: [{ required: true, message: '请选择' }],})(
                  <Select placeholder="请选择颜色">
                    {expressColor.map((row: any) => <Option key={row.value} value={row.value}>{row.label}</Option>)}
                  </Select>
                )}
              </FormItem>
            </Col>
            <Col span={10}>
              <FormItem>
                {getFieldDecorator(`num[${0}]`, { rules: [{ required: true, message: '请选择' }]})(
                  <InputNumber placeholder="输入总仓备量占比，如0.3" style={{ marginRight: 8, width: '100%' }}/>
                )}
              </FormItem>
            </Col>
            <Col span={4}>
              <FormItem>
              <Icon onClick={this.add}   style={{ marginTop: 3 }} type="plus-circle-o" />
              </FormItem>
            </Col>
          </Row>
        </div>
        <FormItem>
            {formItems}
            </FormItem>
              </FormItem>
            </Col>
            </Row>
          {/* <Card bordered title={<span>颜色&nbsp;<Icon onClick={this.add} type="plus-circle-o" /></span>}>
            {formItems}
          </Card> */}
          <Row gutter={16}>
              <FormItem label="铺货类型"  style={{ marginLeft: 5 }}>
                {getFieldDecorator('disbtype', {
                  rules: [{ required: true, message: '请选择铺货类型' }],
                })(
                  <RadioGroup onChange={this.handleChangeShop}>
                    {distype.map((row: any) => <Radio key={row.value} value={row.value}>{row.label}</Radio>) }
                  </RadioGroup>
                )}
              </FormItem>
            </Row>
            {getTypeValue()}
            <Row gutter={16}>
              <Col lg={6} md={12} sm={24}>
                <FormItem label="供应商报价">
                  {getFieldDecorator('offerprice', {
                    rules: [{ required: true, message: '请输入供应商报价' }],
                  })(
                    <InputNumber placeholder="请输入供应商报价" style={{width: '100%'}}/>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
                <FormItem label="经理建议价">
                  {getFieldDecorator('managerprice', {
                    rules: [{ required: true, message: '请输入经理建议价' }],
                  })(
                    <InputNumber placeholder="请输入经理建议价" style={{width: '100%'}}/>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
                <FormItem label="最终确定价">
                  {getFieldDecorator('costprice', {
                    rules: [{ required: true, message: '请输入最终确定价' }],
                  })(
                    <InputNumber placeholder="请输入最终确定价" style={{width: '100%'}}/>
                  )}
                </FormItem>
              </Col>
            </Row>
            <Row gutter={16}>
              <Col lg={6} md={12} sm={24}>
                <FormItem label="成本审核建议价">
                  {getFieldDecorator('lastprice', {
                    rules: [{ required: true, message: '请输入成本审核建议价' }],
                  })(
                    <InputNumber placeholder="请输入成本审核建议价" style={{width: '100%'}}/>
                  )}
                </FormItem>
              </Col>
              <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
                <FormItem label="零售价">
                  {getFieldDecorator('saleprice', {
                    rules: [{ required: true, message: '请输入零售价' }],
                  })(
                    <InputNumber placeholder="请输入零售价" style={{width: '100%'}}/>
                  )}
                </FormItem>
              </Col>
            </Row>
            {getOpBtn()}
          </Card>
        </Form>
        <PullGoods 
          PHData={JSON.stringify(pullData.list)==undefined?[[],[],[]]:pullData.list}
          handleVisible={() => this.handleVisible(false)}
          PHVisible={PHVisible}/>
      </div>
    )
  }
}
export function mapStateToProps({ secordSubmit: { record }, global: { dicts, pullData, band, sample } }: StoreState) {
  return {
    sample,
    band,
    dicts,
    record,
    pullData
  }
}
export function mapDispatchToProps(dispatch: Dispatch<actions.SecordSubmitAction | globalActions.GlobalAction>) {
  return {
    recordDetail: (id: any) => {
      dispatch(actions.recoreMakes({sampleId: id}))
      dispatch(globalActions.getPullData({sampleId: id,pageIndex:1,pageSize:100}))
    },
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(Form.create()(BaseInfo))